package io.qar.reviews.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.qar.commons.mybatis.service.impl.CrudServiceImpl;
import io.qar.reviews.dao.ReviewsDao;
import io.qar.reviews.dto.ReviewsDTO;
import io.qar.reviews.entity.ReviewsEntity;
import io.qar.reviews.service.ReviewsService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * 评论表
 *
 * @author yyyyjinying 1020066395@qq.com
 * @since 3.0 2024-06-10
 */
@Service
public class ReviewsServiceImpl extends CrudServiceImpl<ReviewsDao, ReviewsEntity, ReviewsDTO> implements ReviewsService {

    @Override
    public QueryWrapper<ReviewsEntity> getWrapper(Map<String, Object> params){
        QueryWrapper<ReviewsEntity> wrapper = new QueryWrapper<>();

        String reviewContent = (String)params.get("reviewContent");
        wrapper.eq(StringUtils.isNotBlank(reviewContent), "review_content", reviewContent);
        String reviewTime = (String)params.get("reviewTime");
        wrapper.eq(StringUtils.isNotBlank(reviewTime), "review_time", reviewTime);

        return wrapper;
    }


}